package com.heima.admin.controller.v1;

import com.heima.admin.service.AdSensitiveService;
import com.heima.model.admin.dto.SensitiveDto;
import com.heima.model.admin.pojo.AdSensitive;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("api/v1/sensitive")
@Api(value = "AdSensitiveService",tags = "敏感词管理API")
public class AdSensitiveController {

    /**
     * 分页查询
     */
    @Autowired
    private AdSensitiveService adSensitiveService;
    @PostMapping("/list")
    @ApiOperation("根据敏感词分页查询")
    public ResponseResult list(@RequestBody SensitiveDto dto){

        return adSensitiveService.list(dto);

    }
    /**
     * 添加敏感词
     */
    @ApiOperation("添加敏感词")
    @PostMapping("/save")
    public ResponseResult insert(@RequestBody AdSensitive adSensitive){
        return this.adSensitiveService.insert(adSensitive);
    }
    /**
     * 修改敏感词
     */
    @ApiOperation("敏感词修改")
    @PostMapping("/update")
    public ResponseResult update(@RequestBody AdSensitive adSensitive){
        return this.adSensitiveService.update(adSensitive);

    }
    @ApiOperation("删除敏感词")
    @DeleteMapping("del/{id}")
    public ResponseResult delete(@PathVariable("id") Integer id){
        return this.adSensitiveService.delete(id);
    }


}
